<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="../js/vue.js"></script>
    </head>
    <body>
        <div id="container">
            性别:
            <input type="radio" value="1" v-model="gender" />男
            <input type="radio" value="2" v-model="gender" />女
            <input type="radio" value="3" v-model="gender" />保密
            <br><br>
            您选择的性别是:{{getGender}}
        </div>
        <script>
         var vm=new Vue({
             el:"#container",
             computed:{
                 getGender:function(){
                     if(this.gender==1)
                     return "男";
                     else if(this.gender==2)
                     return "女";
                     else
                     return "保密";
                 }
             },
             data:{
                 gender:1
             }
         });
        </script>
    </body>
</html>
